package org.cargloss.cp.controller.modul.news;

import org.cargloss.cp.controller.modul.PageController;
import org.cargloss.cp.model.News;

import util.hibernate.DAO;

import com.opensymphony.xwork2.ActionSupport;

public class ActionPage extends ActionSupport {
	/**
         *
         */
	private static final long serialVersionUID = 1L;
	PageController pageControl = new PageController();
	private News news;
	private int id;

	public String execute() {
		pageControl.setNavText("News");
		pageControl.setAll(true);
		return SUCCESS;
	}

	public String add() {
		return SUCCESS;
	}

	public String search() {
		return SUCCESS;
	}

	public String delete() {
		getObject();
		return SUCCESS;
	}

	public void getObject() {
		DAO<Integer> dao = new DAO<Integer>();
		dao.createCriteria(News.class);
		dao.addFilter("eq", "id", id);
		setNews((News) dao.findUnique());
	}

	public String edit() {
		getObject();
		return SUCCESS;
	}

	public String detail() {
		getObject();
		return SUCCESS;
	}

	public String news() {
		getObject();
		return SUCCESS;
	}

	public String preview() {
		getObject();
		return SUCCESS;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public PageController getPageControl() {
		return pageControl;
	}

	public void setPageControl(PageController pageControl) {
		this.pageControl = pageControl;
	}

	public News getNews() {
		return news;
	}

	public void setNews(News news) {
		this.news = news;
	}

}
